//
// Created by Semir on 2020/3/27.
//

#include <iostream>
#include <deque>
#include <cstring>


using namespace std;

int n, a, b;
int k[210];
int minStep[210];

void bfs() {
    deque<int> floorQueue;
    int count = 0;
    floorQueue.push_back(a);
    minStep[a] = 0;
    while (!floorQueue.empty()) {
        int floor = floorQueue.front();
        floorQueue.pop_front();
        count = minStep[floor] + 1;
        if (floor == b) {
            break;
        }
        int up = floor + k[floor];
        if (up <= n && minStep[up] < 0) {
            floorQueue.push_back(up);
            minStep[up] = count;
        }
        int down = floor - k[floor];
        if (down > 0 && minStep[down] < 0) {
            floorQueue.push_back(down);
            minStep[down] = count;
        }
    }
}

int main() {
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        cin >> k[i];
    }
    memset(minStep, -1, sizeof(minStep));
    bfs();
    cout << minStep[b] << endl;
    return 0;
}
